<template>
	<view class="page">
		<!---logoflex布局开始-->
		<view class="flex flex-direction flex-wrap align-center justify-center benben-flex-layout register_flex_0">
			<image class='register_fd0_0' mode="aspectFit" :src='STATIC_URL+"2.png"'></image>
		</view>
		<!---logoflex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout register_flex_1">
			<view class='flex flex-wrap align-center register_fd1_0'>
				<image class='register_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"4.png"'></image>
				<input class='flex-sub register_fd1_0_c1' type="number" placeholder="请输入手机号" confirm-type="done"
					:maxlength="11" placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx" v-model="mobile" />
			</view>
			<view class='flex flex-wrap align-center register_fd1_1'>
				<image class='register_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"6.png"'></image>
				<input class='flex-sub register_fd1_1_c1' type="number" placeholder="请输入验证码" confirm-type="done"
					:maxlength="6" placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx" v-model="code" />
				<benben-send-verification-code class='flex  register_fd1_1_c2' after-text='后重新获取' before-text='获取验证码'
					type='1' :phone="mobile"></benben-send-verification-code>
			</view>
			<view class='flex flex-wrap align-center register_fd1_2'>
				<image class='register_fd1_2_c0' mode="aspectFit" :src='STATIC_URL+"3.png"'></image>
				<benben-flex-password-diy v-model="password"
					class-name="flex align-center flex-sub flex register_fd1_2_c1" :placeholder="'请输入密码(6~12位字母+数字)'"
					:maxlength="12" :default-type='true'
					placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx">
					<template #show>
						<text class='fu-iconfont2  register_fd1_2_c1_icon1' data-type="show">&#xE837;</text>
					</template>
					<template #hide>
						<text class='fu-iconfont2  register_fd1_2_c1_icon2' data-type="hide">&#xEBCC;</text>
					</template>
				</benben-flex-password-diy>
			</view>
			<button class='register_fd1_3' @tap.stop="getregister()">注册</button>
			<view class='flex flex-wrap align-center justify-center register_fd1_4'>
				<text class='register_fd1_4_c0'>已有账号,前去</text>
				<text class='register_fd1_4_c1' @tap.stop="handleJumpDiy" data-type="redirectTo"
					:data-url="`/pages/tabBar/login/login`">登录</text>
			</view>
		</view>
		<!---flex布局flex布局结束-->
		<view class="flex flex-wrap align-start justify-center benben-position-layout flex register_flex_2">
			<benben-flex-switch-new class-name='flex align-center flex register_fd2_0' v-model="isCheck"
				:disabled='false'>
				<template v-slot:checked>

					<view class='flex flex position-relative align-center register_checkfd2_0_c0'>
						<image class='register_checkfd2_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"7.png"'></image>
					</view>

				</template>
				<template v-slot:unchecked>

					<view class='flex flex position-relative justify-end align-center register_noCheckfd2_0_c1'>
						<image class='register_noCheckfd2_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"8.png"'></image>
					</view>

				</template>
			</benben-flex-switch-new>
			<text class='register_fd2_1'>已阅读并同意</text>
			<text class='register_fd2_2' @tap.stop="handleJumpDiy" data-type="navigateTo"
				:data-url="`/pages/denglu/agreement/agreement`">《用户注册协议》</text>
			<text class='register_fd2_3'>与</text>
			<text class='register_fd2_4' @tap.stop="handleJumpDiy" data-type="navigateTo"
				:data-url="`/pages/denglu/strategy/strategy`">《隐私政策》</text>

		</view>
		<view :style="{height: '71rpx'}"></view>

	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},

		data() {
			return {
				"isCheck": false,
				"mobile": "",
				"code": "",
				"password": "",
				"User": {
					"userinfo": {
						"autograph": "",
						"is_finger": "",
						"invite_code": "",
						"client_id": "",
						"address_code": "",
						"address": "",
						"birthday": "",
						"mobile": "",
						"user_level": "",
						"user_type": "",
						"sex": "",
						"user_email": "",
						"user_nickname": "",
						"user_name": "",
						"head_img": "",
						"id": "",
						"user_token": ""
					}
				}
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//注册
			async getregister() {
				if (!validate(this.mobile, 'require')) {
					this.$message.info('手机号不能为空');
					return false;
				}
				if (!validate(this.mobile, 'phone')) {
					this.$message.info('手机号格式不正确');
					return false;
				}
				if (!validate(this.code, 'require')) {
					this.$message.info('验证码不能为空');
					return false;
				}
				if (!validate(this.code, 'captcha')) {
					this.$message.info('验证码格式不正确');
					return false;
				}
				if (!validate(this.password, 'require')) {
					this.$message.info('密码不能为空');
					return false;
				}
				if (!validate(this.password, 'password')) {
					this.$message.info('请输入密码（6~12位字母+数字）');
					return false;
				}
				if (!(this.isCheck === true)) {
					this.$message.info('请先勾选《用户注册协议》与《隐私政策》');
					return false;
				}
				//请求方法
				//数据验证

				let UserData = await this.$api.post(global.apiUrls.post5cad9f63e4f94, {
					mobile: this.mobile,
					code: this.code,
					type: '1',
					password: this.password
				});
				if (UserData.data.code != 1) {
					this.$message.info(UserData.data.msg);
					return
				}
				let Userinfo = UserData.data;
				this.User = Userinfo.data
				this.$urouter.navigateTo(`/pages/tabBar/login/login`);
			}
		}
	};
</script>
<style lang="scss" scoped>
	::v-deep .register_fd2_0 {
		margin: 5rpx 12rpx 0rpx 0rpx;
	}

	.register_checkfd2_0_c0 {
		width: 28rpx;
		height: 28rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		transform: translateY(-6rpx);
		padding-top: 4rpx;
	}

	.register_checkfd2_0_c0_c0 {
		width: 28rpx;
		height: 28rpx;
		border-radius: 50%;
	}

	.register_noCheckfd2_0_c1 {
		width: 28rpx;
		height: 28rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		transform: translateY(-6rpx);
		padding-top: 4rpx;
	}

	.register_noCheckfd2_0_c1_c0 {
		border-radius: 50%;
		width: 28rpx;
		height: 28rpx;
	}

	.register_fd2_1 {
		line-height: 30rpx;
		font-size: 22rpx;
		font-weight: 500;
		color: rgba(153, 153, 153, 1);
	}

	.register_fd2_2 {
		line-height: 30rpx;
		font-size: 22rpx;
		font-weight: 500;
		color: #181818;
	}

	.register_fd2_3 {
		line-height: 30rpx;
		font-size: 22rpx;
		font-weight: 500;
		color: rgba(153, 153, 153, 1);
	}

	.register_fd2_4 {
		line-height: 30rpx;
		font-size: 22rpx;
		font-weight: 500;
		color: #181818;
	}

	.register_flex_2 {
		background: #fff;
		background-size: 100% !important;
		width: 750rpx;
		height: 71rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		background-size: 100% auto !important;
	}

	.register_fd1_0 {
		border-bottom: 1px solid #eee;
		height: 125rpx;
	}

	.register_fd1_0_c0 {
		width: 34rpx;
		height: 34rpx;
		margin: 0rpx 28rpx 0rpx 0rpx;
	}

	.register_fd1_0_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.register_fd1_1 {
		border-bottom: 1px solid #eee;
		height: 125rpx;
	}

	.register_fd1_1_c0 {
		width: 34rpx;
		height: 34rpx;
		margin: 0rpx 28rpx 0rpx 0rpx;
	}

	.register_fd1_1_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.register_fd1_1_c2 {
		line-height: 40rpx;
		font-size: 28rpx;
		color: #1593FF;
		font-weight: 500;
	}

	.register_fd1_2 {
		border-bottom: 1px solid #eee;
		height: 125rpx;
	}

	.register_fd1_2_c0 {
		width: 34rpx;
		height: 34rpx;
		margin: 0rpx 28rpx 0rpx 0rpx;
	}

	::v-deep .register_fd1_2_c1 {
		font-size: 32rpx;
		color: #333;
		font-weight: 400;
		width: 570rpx;
	}

	.register_fd1_2_c1_icon1 {
		text-align: center;
		font-size: 34rpx;
		font-weight: 600;
	}

	.register_fd1_2_c1_icon2 {
		text-align: center;
		font-size: 40rpx;
	}

	.register_fd1_3 {
		background: rgba(21, 147, 255, 1);
		background-size: 100% !important;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
		line-height: 88rpx;
		font-weight: 500;
		margin: 104rpx 0rpx 0rpx 0rpx;
	}

	.register_fd1_4 {
		line-height: 40rpx;
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.register_fd1_4_c0 {
		font-size: 28rpx;
		font-weight: 700;
		color: rgba(153, 153, 153, 1);
		line-height: 40rpx;
	}

	.register_fd1_4_c1 {
		font-size: 28rpx;
		font-weight: 700;
		color: #1593FF;
		line-height: 40rpx;
	}

	.register_flex_1 {
		padding: 0rpx 56rpx 0rpx 56rpx;
	}

	.register_fd0_0 {
		background: transparent;
		background-size: 100% !important;
		width: 180rpx;
		height: 180rpx;
		border-radius: 48rpx 48rpx 48rpx 48rpx;
		background-size: 100% auto !important;
	}

	.register_flex_0 {
		padding: 110rpx 0rpx 80rpx 0rpx;
	}

	.page {
		min-height: calc(100vh - var(--window-bottom));
		background: url(https://app.ezsdcsm.com/images/1.png) no-repeat, #fff;
		background-size: 100% auto !important;
	}
</style>
